function getAjax(url, suc_fun) {
    $.ajax({
        type: "GET",
        // url: urlPre() + url,
        url: url,
        dataType: "json",
        success: function (data) {
            suc_fun(data);
        },
        error: function (err) {
            console.log(err);
        }
    })
}

function postAjax(url, data, suc_fun) {
    $.ajax({
        type: "POST",
        url: urlPre() + url,
        data: data,
        dataType: "json",
        success: function (data) {
            suc_fun(data);
        },
        error: function (err) {
            console.log(err);
        }
    })
}

function backPage() {
    window.history.back()
}

function validData(data, suc_fun) {
    if (data) {
        if (data.success) {
            suc_fun(data);
        } else {
            alert(data.msg);
        }
    } else {
        alert('返回数据为空。');
    }
}

function urlPre() {
    var url = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
    return url;
}

function jumpPage(url){
    window.location.href = urlPre() + url;
}